package com.dingding.service.activity.core.dao.impl;

import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.dingding.common.core.base.dao.impl.BaseDaoImpl;
import com.dingding.common.core.beans.ActivityInfoBanner;
import com.dingding.service.activity.core.dao.IActivityInfoBannerDao;

/**
 * @ClassName: ActivityDaoImpl
 * @Description: 活动模块DAO实现类
 * @author yuHaiQing
 * @date 2016年3月24日 上午11:38:56
 */
@Component("activityInfoBannerDao")
public class ActivityInfoBanneDaorImpl extends BaseDaoImpl<ActivityInfoBanner> implements IActivityInfoBannerDao {

	/**
	 * @Description:根据获取活动id获取活动banner
	 * @author fengshuonan
	 * @return ActivityInfoBanner 活动的banner
	 * @Override
	 */
	@Transactional(readOnly = true)
	public ActivityInfoBanner getActivityDetailBanner(String activityId) {

		// 声明存储活动详情的对象
		ActivityInfoBanner activityInfoBanner = null;

		Criterion criterion = Restrictions.and(Restrictions.eq("snSatatus", 1),
				Restrictions.eq("activityId", activityId));

		try {
			activityInfoBanner = super.queryCriteriaUnResult(criterion);
		} catch (Exception e) {
			log.error("获取活动banner的时候出错！ActivityInfoBannerImpl：getActivityDetailBanner（）", e);
		}

		return activityInfoBanner;
	}

}
